<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page session="false"%>
<%@ page pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>注册公司会员</title>
        <META http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <link href="<c:url value="/resources/css/normalize.css" />" rel="stylesheet" type="text/css" />
		<link href="<c:url value="/resources/css/lib.css" />" rel="stylesheet" type="text/css" />
		<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet" type="text/css" />
        
        <link href="<c:url value="/resources/jqueryui/1.8/themes/ui-lightness/jquery-ui-1.8.16.custom.css" />" rel="stylesheet" type="text/css" />
        <script src="<c:url value="/resources/jquery/jquery.js" />"></script>
        <script src="<c:url value="/resources/jqueryui/1.8/jquery-ui-1.8.16.custom.min.js" />"></script>
        <script src="<c:url value="/resources/jqueryui/1.8/jquery.ui.datepicker-zh-CN.js" />"></script>
        <script src="<c:url value="/resources/scripts/regionUtil.js" />"></script>
		<style>
#regionSelectorContainer select {
	display: inline;
	margin-right: 10px;
}
</style>
	</head>
	<body>
		<jsp:include page="/resources/static/menu.jsp"></jsp:include>
		<div class="box3">
		<div class="box2">
			<form:form id="form" method="post" modelAttribute="companyMember">
				<c:if test="${not empty message}">
					<div id="message" class="success">
						${message}
					</div>
				</c:if>
				<table class="regTable">
					<tr class="b">
                        <td colspan="2">登陆帐户</td>
                    </tr>
                    <tr>
                    	<td width="20%" align="right">用户名:</td>
                    	<td width="80%">
                    	<c:if test="${empty companyMember.id}">
                        	<form:input class="input-style1" path="username" id="username" /><span class="red"> *</span>
                        	<span id="usernameCheckerYes" class="ok">该用户名可用</span>
                        	<span id="usernameCheckerNo" class="bad">该用户名不可用</span>
                        	<span class="red" id="usernameInvalid"><form:errors path="username" /></span>
                        </c:if>
                         <c:if test="${not empty companyMember.id}">
                         	${companyMember.username} <form:hidden path="username" />
                         </c:if>
                    	</td>
                    </tr>
                    <tr>
                    	<td align="right">密码:</td>
                    	<td>
                    		<form:password class="input-style1" path="password" />
                    		<span class="red"> * <form:errors path="password"	/></span>
                    	</td>
                    </tr>
                    <tr>
                    	<td align="right">确认密码:</td>
                    	<td>
                    		<form:password class="input-style1" path="password1" />
                    		<span class="red"> * <form:errors path="password1"	/></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">Email:</td>
                    	<td>
                    		<form:input class="input-style1" path="email" />
                    		<span class="red"> * <form:errors path="email" /></span>
                    	</td>
                    </tr>
					<tr>
						<td colspan="2" class="b">公司信息</td>
					</tr>
					<tr>
                    	<td align="right">公司名称:</td>
                    	<td>
                    		<form:input class="input-style1" path="name" />
                    		<form:hidden path="id" />
                    		<span class="red"> * <form:errors path="name" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">所在区域:</td>
                    	<td>
                    		<form:hidden path="regionId" />
                    		<span id="regionSelectorContainer"></span>
                    		<span class="red"> * <form:errors path="regionId" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">电话:</td>
                    	<td>
                    		<form:input class="input-style1" path="tel" />
                    		<span class="red"> * <form:errors path="tel" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">传真:</td>
                    	<td>
                    		<form:input class="input-style1" path="fax" />
                    		<span class="red"> * <form:errors path="fax" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">联系地址:</td>
                    	<td>
                    		<form:input class="input-style1" path="address" />
                    		<span class="red"> * <form:errors path="address" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">邮编:</td>
                    	<td>
                    		<form:input class="input-style1" path="postCode" />
                    		<span class="red"> * <form:errors path="postCode" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">移动电话:</td>
                    	<td>
                    		<form:input class="input-style1" path="mobile" />
                    		<span class="red"> * <form:errors path="mobile" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">公司简介:</td>
                    	<td>
                    		<form:textarea class="input-style1" path="description" />
                    		<span class="red"> * <form:errors path="description" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">法人代表:</td>
                    	<td>
                    		<form:input class="input-style1" path="legalPerson" />	
                    		<span class="red">  <form:errors path="legalPerson" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">公司类型:</td>
                    	<td>
                    		<form:select path="type">
								<option value="">请选择...</option>
								<option value="国有企业" <c:if test="${companyMember.type eq '国有企业'}">selected</c:if>>国有企业</option>	
								<option value="私营企业" <c:if test="${companyMember.type eq '私营企业'}">selected</c:if>>私营企业</option>	
								<option value="合资企业" <c:if test="${companyMember.type eq '合资企业'}">selected</c:if>>合资企业</option>					
							</form:select>
                    		<span class="red"> * <form:errors path="type" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">网站:</td>
                    	<td>
                    		<form:input class="input-style1" path="website" />
                    		<span class="red"><form:errors path="website" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">工商注册号:</td>
                    	<td>
                    		<form:input class="input-style1" path="regNo" />
                    		<span class="red"> <form:errors path="regNo" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right">主营业务介绍:</td>
                    	<td>
                    		<form:textarea class="input-style1" path="biz" />
                    		<span class="red"><form:errors path="biz" /></span>
                    	</td>
                    </tr>
                    <tr>
                    	<td align="right">验证码:</td>
                    	<td>
                    		<form:input path="validCode" /><span class="red mr5"> *</span> 
                    		<img src="<c:url value="/validCode" />" id="validCodeImg" class="vm"/>
                    		<span class="red"><form:errors path="validCode" /></span>
                    	</td>
                    </tr>
					<tr>
                    	<td align="right"></td>
                    	<td>
                    	<c:if test="${not empty companyMember.id}">
							<input type="submit" value="更新" />
						</c:if>
						<c:if test="${empty companyMember.id}">
							<input type="submit" value="提交" />
						</c:if>
                    	</td>
                    </tr>
                    
				</table>
			</form:form>
		</div>
		</div>
		<jsp:include page="/resources/static/footer.jsp"></jsp:include>
	</body>
</html>
<script>
$(document).ready(function(){
	RegionUtil.restoreSel();
	
	$('#validCode').val('');

	$('#validCodeImg').click(function(){
		var validCodeUrl = '<c:url value="/validCode" />?';
		$(this).attr('src', validCodeUrl + new Date);
	});
	$('#username').blur(function(){
		var u = $(this).val();
		if(u.length==0){
			return;
		}
		$.get('<c:url value="/checkUserExist?username="/>' + u, function(data){
			if(data=='yes'){
				$('#usernameCheckerYes').show();
				$('#usernameCheckerNo').hide();
				$('#usernameInvalid').hide();
			}
			else{
				$('#usernameCheckerNo').show();
				$('#usernameCheckerYes').hide();
				$('#usernameInvalid').hide();
			}
		})
	});
});

</script>
